package com.sright.bcard.enterprise.biz.service;

import com.sright.bcard.common.service.share.dto.page.PageDTO;
import com.sright.bcard.common.service.share.dto.page.PageParamRequest;
import com.sright.bcard.enterprise.biz.manager.AddressManager;
import com.sright.bcard.common.service.share.dto.enterprise.AddressDTO;
import com.sright.bcard.enterprise.share.service.AddressService;
import com.sright.common.response.SrightResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class AddressServiceImpl implements AddressService {

    @Autowired
    private AddressManager addressManager;

    @Override
    public SrightResponse<PageDTO<AddressDTO>> addressList(PageParamRequest pageParamRequest) {
        return SrightResponse.defaultSuccess(addressManager.addressList(pageParamRequest));
    }

    @Override
    public SrightResponse<Long> addAddress(AddressDTO addressDTO) {
        return SrightResponse.defaultSuccess(addressManager.addAddress(addressDTO));
    }

    @Override
    public SrightResponse<Boolean> updateAddress(AddressDTO addressDTO) {
        return SrightResponse.defaultSuccess(addressManager.updateAddress(addressDTO));
    }

    @Override
    public SrightResponse<Boolean> deleteAddress(List<Long> ids) {
        return SrightResponse.defaultSuccess(addressManager.deleteAddress(ids));
    }

    @Override
    public SrightResponse getList(Long enterpriseId) {
        return SrightResponse.defaultSuccess(addressManager.getList(enterpriseId));
    }
}
